package businesslogic;

import java.rmi.RemoteException;
import java.util.Calendar;
import java.util.Date;

import po.PromotionPO;

import databaseservice.PromotionPOService;

import businesslogic.network.RMIStubClient;
import businesslogicservice.PromotionBLService;

public class PromotionBLService_stub implements PromotionBLService{

	private PromotionPOService ppos;
	public PromotionBLService_stub(RMIStubClient rmi){
		this.ppos=rmi.promotionPOService;
	}
	@Override
	public boolean setIntegralRatio(int ratio){
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setIntegralRatio(ratio);
		try {
			return ppos.setIntegralRatio(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setDate_integral(Date date) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setEndDate_discount(date);
		try {
			return ppos.setIntegralRatio(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setEquivalentCouponLimit(int limit) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setEquivalentCouponLimit(limit);
		try {
			return ppos.setEquivalent(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setEquivalentCouponRatio(int ratio) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setEquivalentCouponRatio(ratio);
		try {
			return ppos.setEquivalent(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setDate_equivalent(Date date) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setEndDate_equivalent(date);
		try {
			return ppos.setEquivalent(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setDiscountRatio(int ratio) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setDiscountRatio(ratio);
		try {
			return ppos.setDiscount(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setDate_discount(Date date) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setEndDate_discount(date);
		try {
			return ppos.setDiscount(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setBigPromotion(int[] rank, int[] num1, int[] num2) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setRank(rank);
		ppo.setNum1(num1);
		ppo.setNum2(num2);
		try {
			return ppos.setBigPromotion(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public boolean setDate_BigPromotion(Date date) {
		// TODO Auto-generated method stub
		PromotionPO ppo=new PromotionPO();
		ppo.setEndDate_promotion(date);
		try {
			return ppos.setBigPromotion(ppo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}

}
